<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2022/11/3
  Time: 10:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<% //获取当前项目的项目名
    String path=request.getContextPath();
    //获取动态的网络地址 http://ip:port/项目名/
    String mbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+path+"/";//前台的路径
    String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/NEUC_Manager/";//后台的路径
    //存入全局域
    application.setAttribute("basePath", basePath); application.setAttribute("mbasePath", mbasePath);
%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>蓝瓜新能源二手车首页</title>
    <link type="text/css" href="css/index.css" rel="stylesheet" />
    <!--<link type="text/css" href="/css/index.css" rel="stylesheet" />-->
    <link type="text/css" href="css/common.css" rel="stylesheet" />
    <link type="text/css" href="css/reset.css" rel="stylesheet" />
    <link rel="shortcut icon" type="image/x-icon" href="images/nangua.jpg" media="screen" />
</head>

<body>

<script>
    function CarDetails(car_id){
        location.href="queryCarByid.do?car_id=" + car_id;
    }
</script>
<script>
    function search() {
        var search = $("#search").val();
        if (search == '') {
            alert("请输入品牌名再点击搜索！！！")
        } else {
            location.href = "getCarDeptByBrand.do?car_brand=" + search;
        }
    }
</script>
<script>
    function searchByBrand(car_brand){
        location.href = "getCarDeptByBrand.do?car_brand=" + car_brand;
    }
</script>
<script>
    function searchByprice(car_price){
        location.href="selectCarByMuplCondition.do?car_price="+car_price + "万";
    }
</script>



<script>
    function newest(page, size) {
        var address = '${sessionScope.fixcity}';
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var car_time = year + "-" + month;
        $.ajax({
            url: "getcarByNewTime.do",
            data: {
                address: address,
                car_time: car_time,
                page: page,
                size: size,
            },
            dataType: "json",
            success: function (msg) {
                //alert(msg)
                if (msg.code = "200") {
                    if (msg.flag == 0) {
                        //表示没有数据
                        $("indexcontent").html(msg.info);
                    } else {
                        //表示有数据
                        var mydata = msg.data.olist;
                        var html = '';
                        for (var i = 0; i < mydata.length; i++) {
                            html+='<div class="index_content_con_margin_l"><!--只用来向右移动的，这样才不会有一个因为父级宽度不够出现在下方-->';
                            html+='<div class="index_content_con_c'+i+' index_content_con_c width_h_292_276 over_hidden fl"><!--只用来设置内边距--><!--用来设置外右边距-->';
                            html+='<div class="index_content_con_cc width_h_292_276">';
                            html+='<div class="index_content_con_pic width_h_292_186">';
                            html+='<a href="javascript:CarDetails(\''+mydata[i].car_id+'\')"><img src="'+'${applicationScope.basePath}'+'upload/'+mydata[i].pic_main+'" width="292" height="186"/></a>';
                            html+='</div>';
                            html+='<div class="index_content_con_txt width_h_292_90">';
                            html+='<p class="p1">';
                            html+='<a  href="javascript:javascript:CarDetails(\''+mydata[i].car_id+'\')">'+mydata[i].car_name+'</a>';
                            html+='</p>';
                            html+='<p class="p2">';
                            html+='<span class="">'+mydata[i].car_regist+'上牌&nbsp;&nbsp;</span><em class="shuxian">|</em>&nbsp;&nbsp;行驶'+mydata[i].car_mile+'万公里';
                            html+='</p>';
                            html+='<p class="p3">';
                            html+='<span><i class="fc-org priType">现价：'+mydata[i].car_price+'万</i></span>&nbsp;&nbsp;<s><font style="color: #761c19">原价：'+mydata[i].car_newprice+'万</font></s>';
                            html+='</p>';
                            html+='</div>';
                            html+='</div>';
                            html+='</div>';
                            html+='</div>';
                        }

                        $("#newest").html(html);

                    } //else括号
                } //if括号
            } //success括号
        });
    };

    function allowNewCar(page,size){
        var address='${sessionScope.fixcity}';
        var summile = 10;
        $.ajax({
            url : "getcarByCarMile.do",
            data : {
                address : address,
                summile:summile,
                page:page,
                size:size,
            },
            dataType : "json",
            success:function (msg){
                //alert(msg)
                if(msg.code = "200"){
                    if(msg.flag == 0 ){
                        //表示没有数据
                        $("newsell").html(msg.info);
                    }else{
                        //表示有数据
                        var mydata = msg.data.olist;
                        var html='';
                        for (var i = 0; i < mydata.length; i++) {
                            html+='<div class="index_content_con_margin_l"><!--只用来向右移动的，这样才不会有一个因为父级宽度不够出现在下方-->';
                            html+='<div class="index_content_con_c'+i+' index_content_con_c width_h_292_276 over_hidden fl"><!--只用来设置内边距--><!--用来设置外右边距-->';
                            html+='<div class="index_content_con_cc width_h_292_276">';
                            html+='<div class="index_content_con_pic width_h_292_186">';
                            html+='<a href="javascript:CarDetails(\''+mydata[i].car_id+'\')"><img src="${applicationScope.basePath}'+'upload/'+mydata[i].pic_main+'" width="292" height="186"/></a>';
                            html+='</div>';
                            html+='<div class="index_content_con_txt width_h_292_90">';
                            html+='<p class="p1">';
                            html+='<a title="" href="javascript:CarDetails(\''+mydata[i].car_id+'\')">'+mydata[i].car_name+'</a>';
                            html+='</p>';
                            html+='<p class="p2">';
                            html+='<span class="">'+mydata[i].car_regist+'上牌&nbsp;&nbsp;</span><em class="shuxian">|</em>&nbsp;&nbsp;行驶'+mydata[i].car_mile+'万公里';
                            html+='</p>';
                            html+='<p class="p3">';
                            html+='<span><i class="fc-org priType">现价：'+mydata[i].car_price+'万</i></span>&nbsp;&nbsp;<s><font style="color: #761c19">原价：'+mydata[i].car_newprice+'万</font></s>';
                            html+='</p>';
                            html+='</div>';
                            html+='</div>';
                            html+='</div>';
                            html+='</div>';
                        }

                        $("#allowNewCar").html(html);

                    } //else括号
                } //if括号
            } //success括号
        });
    };
</script>
<script>
    function cityselect(page, size) {
        //获取地区
        var address = '';
        var sessionCity = '${sessionScope.fixcity}';
        var inputCity = $("#citySelect").val();

        if (sessionCity == '') {
            address = inputCity;
        } else {
            address = sessionCity;
        }
        $.ajax({
            url: "getcarByAddress.do",
            data: {
                address: address,
                page: page,
                size: size,
            },
            dataType: "json",
            success: function (msg) {
                if (msg.code = "200") {
                    if (msg.flag == 0) {
                        //表示没有数据
                        $("indexcontent").html(msg.info);
                    } else {
                        //表示有数据
                        var mydata = msg.data.olist;
                        var html = "";
                        for (let i = 0; i < msg.data.length; i++) {
                            html+='<div class="index_content_con_margin_l"><!--只用来向右移动的，这样才不会有一个因为父级宽度不够出现在下方-->';
                            html+='<div class="index_content_con_c'+i+' index_content_con_c width_h_292_276 over_hidden fl"><!--只用来设置内边距--><!--用来设置外右边距-->';
                            html+='<div class="index_content_con_cc width_h_292_276">';
                            html+='<div class="index_content_con_pic width_h_292_186">';
                            html+='<a href="javascript:CarDetails(\''+mydata[i].car_id+'\')"><img src="'+'${applicationScope.basePath}'+'upload/'+mydata[i].pic_main+'" width="292" height="186"/></a>';
                            html+='</div>';
                            html+='<div class="index_content_con_txt width_h_292_90">';
                            html+='<p class="p1">';
                            html+='<a title="" href="javascript:CarDetails(\''+mydata[i].car_id+'\')">'+mydata[i].car_name+'</a>';
                            html+='</p>';
                            html+='<p class="p2">';
                            html+='<span class="">'+mydata[i].car_regist+'上牌&nbsp;&nbsp;</span><em class="shuxian">|</em>&nbsp;&nbsp;行驶'+mydata[i].car_mile+'万公里';
                            html+='</p>';
                            html+='<p class="p3">';
                            html+='<span><i class="fc-org priType">现价：'+mydata[i].car_price+'万</i></span>&nbsp;&nbsp;<s><font style="color: #761c19">原价：'+mydata[i].car_newprice+'万<font></s>';
                            html+='</p>';
                            html+='</div>';
                            html+='</div>';
                            html+='</div>';
                            html+='</div>';
                        }
                        $("newsell").html(html);

                    } //else括号
                } //if括号
            } //success括号
        });

    }
</script>


<div class="index position_re">

    <jsp:include page="head.jsp"></jsp:include>
    <div class="hr_5"></div>
    <div class="index_main width_1200_center">
        <div class="index_main_cate fl over_hidden">
            <div class="index_main_car">

                <div class="index_main_car_list display_n width_270">
                    <dl>
                        <dd><a href="javascript:void(0)">A&nbsp;奥迪</a></dd>
                        <dd><a href="javascript:void(0)">B&nbsp;奔驰</a></dd>
                        <dd><a href="javascript:void(0)">B&nbsp;宝马</a></dd>
                        <dd><a href="javascript:void(0)">B&nbsp;标致</a></dd>
                        <dd><a href="javascript:void(0)">B&nbsp;比亚迪</a></dd>

                    </dl>
                </div>
            </div>
            <div class="index_main_cate1 width_270">
                <div class="index_main_cate2 width_h_270_90">
                    <div class="index_main_csign position_re width_h_230_90">
                        <p class="p1">
                            <a href="#" target="_blank">品牌</a>
                        </p>
                        <p class="p2"><a href="#" target="_blank">哪吒</a><a href="javascript:searchByBrand('哪吒')"
                                                                           target="_blank">特斯拉</a><a href="searchByBrand('小鹏')" target="_blank">小鹏</a><a href="javascript:searchByBrand('宝马')"
                                                                                                                                                         target="_blank">日产</a>
                        </p>

                    </div>
                </div>

                <div class="index_main_cprice width_h_230_90">
                    <p class="p1">
                        <a href="#" target="_blank">价格</a>
                    </p>
                    <p class="p2">
                        <a href="javascript:searchByprice(3-5)" target="_blank">3-5万</a>
                        <a href="javascript:searchByprice(8-10)" target="_blank">8-10万</a>
                        <a href="javascript:searchByprice(10-15)" target="_blank">10-15万</a>
                        <a href="javascript:searchByprice(15-20)" target="_blank">15-20万</a>
                        <a href="javascript:searchByprice(20-30)" target="_blank">20-30万</a>
                        <a href="javascript:searchByprice(30-50)" target="_blank">30万以上</a>
                    </p>
                </div>
                <div class="index_main_cage width_h_230_90">
                    <p class="p1">
                        <a href="#" target="_blank">车龄</a>
                    </p>
                    <p class="p2"><a href="#" target="_blank">1年内</a><a href="#"
                                                                        target="_blank">2年内</a><a href="#" target="_blank">2-4年</a><a href="#"
                                                                                                                                      target="_blank">4-6年</a><a href="#" target="_blank">6-8年</a><a href="#"
                                                                                                                                                                                                     target="_blank">8年以上</a>
                    </p>
                </div>
                <div class="index_main_ctype width_h_230_85">
                    <p class="p1">
                        <a href="#" target="_blank">车型</a>
                    </p>
                    <p class="p3">
                    </p>
                    <p class="p4"><span class="hrv"><a href="#" target="_blank">hrv</a></span><span
                            class="jiao"><a href="#" target="_blank">桥车</a></span><span class="pao"><a
                            href="#" target="_blank">跑车</a></span><span class="suv"><a href="#"
                                                                                       target="_blank">suv</a></span><span class="mpv"><a href="#"
                                                                                                                                          target="_blank">mpv</a></span>
                    </p>
                </div>
            </div>
        </div>
        <div class="index_main_pic width_916 fr">
            <div id="playBox">
                <div class="pre"></div>
                <div class="next"></div>
                <div class="smalltitle">
                    <ul>
                        <li class="thistitle"></li>
                        <li></li>
                        <li></li>
                        <li></li>
                    </ul>
                </div>
                <ul class="oUlplay">
                    <li><a href="#"><img title="蓝瓜车行界" src="images/index_main_pic1.png" /></a></li>
                    <li><a href="#"><img title="蓝瓜车行界" src="images/index_main_pic2.png" /></a></li>
                    <li><a href="#"><img title="蓝瓜车行界" src="images/index_main_pic3.png" /></a></li>
                    <li><a href="#"><img title="蓝瓜车行界" src="images/index_main_pic4.png" /></a></li>
                </ul>
            </div>
            <div class="hr_5"></div>
            <div class="index_main_pic_hcs width_916 over_hidden fr">
                <div class="index_main_pic_good cursor position_re width_h_300_100 fl">
                    <div class="index_main_pic_good_txt position_ab">
                        <h1>好车推荐</h1>
                        <p>这里有你想要的</p>
                    </div>
                    <div class="index_main_pic_good_pic position_ab"><img title="好车推荐"
                                                                          src="images/index_main_pic_good_pic.png" /></div>
                </div>
                <div class="wr_8 fl"></div>
                <div class="index_main_pic_know cursor position_re width_h_300_100 fl">
                    <div class="index_main_pic_know_txt position_ab">
                        <h1>车辆知识</h1>
                        <p>希望你看得懂的</p>
                    </div>
                    <div class="index_main_pic_know_pic position_ab"><img title="车辆知识"
                                                                          src="images/index_main_pic_know_pic.png" /></div>
                </div>
                <div class="wr_8 fl"></div>
                <div class="index_main_pic_story cursor position_re width_h_300_100 fl">
                    <div class="index_main_pic_story_txt position_ab">
                        <h1>人车故事</h1>
                        <p>你有故事我有车</p>
                    </div>
                    <div class="index_main_pic_story_pic position_ab"><img title="深度体验"
                                                                           src="images/index_main_pic_story_pic.png" /></div>
                </div>
            </div>
        </div>
    </div>
    <div class="index_content width_1200_center">
        <div class="index_content_nav clearfix">
            <h1>淘我爱车&minus;实惠二手车</h1>
            <div class="index_content_nav1 clearfix">
                <div class="index_content_nav_like fl"><a href="javaScript:newest(1,12)">最新上架</a></div>
                <div class="index_content_nav_newest fl"><a href="javaScript:allowNewCar(1,12)">准新车</a></div>
                <div class="index_content_nav_more fr"><a href="buycar.jsp">查看更多&gt;&gt;</a></div>
            </div>
        </div>
        <div class="hr_5"></div>

        <div class="index_content_con width_1200_center index_content_con1 over_hidden clearfix" id="newest" ><!--设置over_hidden版权才不会跟上来1-->



        </div >

        <div class="index_content_con width_1200_center index_content_con2 over_hidden display_n clearfix" id="allowNewCar" ><!--设置over_hidden版权才不会跟上来2-->


        </div>

    </div>
    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script><!--必须得放在第一的位置-->
<script type="text/javascript" src="js/index_type_more.js"></script>
<script type="text/javascript" src="js/index_main_pic.js"></script>
<script type="text/javascript" src="js/common.js"></script>
</body>
</html>

